package com.tanker.web.controller;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.tanker.web.dao.po.User;
import com.tanker.web.dto.req.UserCreateRequest;
import com.tanker.web.dto.req.UserQueryRequest;
import com.tanker.web.dto.resp.Response;
import com.tanker.web.dto.resp.UserDto;
import com.tanker.web.service.UserService;

@RestController
@RequestMapping(value = "/")
public class UserController {
	@Autowired
	private UserService userService;
	
	@PostMapping(value="/user")
	public String create(UserCreateRequest request){
		User user = new User();
		BeanUtils.copyProperties(request, user);
		UserDto userDto= userService.create(user);
		return Response.success(userDto);
	}
	@GetMapping(value="/user")
	public String query(UserQueryRequest request){
		return null;
	}
}
